
		Imports Acceso_a_Datos.Datos
		Namespace BO
		Partial Public Class tEtapas



# Region "tMicroemprendimientos"

		private mtMicroemprendimientos As New tMicroemprendimientos

		Public Property tMicroemprendimientos As tMicroemprendimientos
        Get
                mtMicroemprendimientos = mtMicroemprendimientos.TraerFiltradoListOf("IdMicroemprendimiento", Me.IdMicroemprendimiento).Item(0)
        Return mtMicroemprendimientos
        End Get
        Set
             If ((mtMicroemprendimientos Is Nothing) Or (Me.tMicroemprendimientos.Equals(value) = False)) Then
                If Not (Me.tMicroemprendimientos Is Nothing)
	               Dim oldtMicroemprendimientos As tMicroemprendimientos = Me.tMicroemprendimientos
                   Me.mtMicroemprendimientos = Nothing
                   oldtMicroemprendimientos.RemoveListatEtapas(Me)
             	End If
            	If Not (value Is Nothing) Then
                   Me.mtMicroemprendimientos = value
                   Me.tMicroemprendimientos.AddListatEtapas(Me)
            	End If
             End If
        End Set
       End Property

# End Region
# Region "tVisitas"
	private mlistatVisitas As New List (Of tVisitas)
Public Property ListatVisitas As System.Collections.Generic.List(Of tVisitas)
Get
dim mtVisitas As New tVisitas
mlistatVisitas =mtVisitas.TraerFiltradoListOf("IdEtapas",Me.IdEtapas)
Return mlistatVisitas
End Get
Set
RemoveAllListatVisitas()
If Not (Value Is Nothing) Then
Dim otVisitas As tVisitas
	For Each otVisitas in Value
		AddListatVisitas(otVisitas)
	Next
End If
End Set
End Property


		
		
	   Public Sub AddListatVisitas(newtVisitas As tVisitas)
	If (mlistatVisitas Is Nothing) Then
		mlistatVisitas = new System.Collections.Generic.List(Of tVisitas)
	End If
	If Not mlistatVisitas.Contains(newtVisitas) Then
		mlistatVisitas.Add(newtVisitas)
		newtVisitas.tEtapas = Me
	End If
End Sub

	   
	   
	   
	   Public Sub RemoveListatVisitas(oldtVisitas As tVisitas)
	If (mlistatVisitas.Contains(oldtVisitas)) Then
		mlistatVisitas.Remove(oldtVisitas)
		oldtVisitas.tEtapas = Nothing
	End If
End Sub
	
			
			Public Sub RemoveAllListatVisitas()
	If Not (mlistatVisitas Is Nothing)
		Dim tmp_listatVisitas As System.Collections.ArrayList = new System.Collections.ArrayList()
		Dim oldtVisitas As tVisitas
		For Each oldtVisitas in mlistatVisitas
			tmp_listatVisitas.Add(oldtVisitas)
		Next
	mlistatVisitas.Clear()
	For Each oldtVisitas in tmp_listatVisitas
		oldtVisitas = Nothing
	Next
	tmp_listatVisitas.Clear()
	End If
End Sub

# End Region


# Region "Lecturas que devuelven listas"
Public Function TraerTodosListOf() As List(Of tEtapas)
            Dim dtDatos As DataTable
            Dim listatEtapas As New List(Of tEtapas)
            Dim param As [String]
            param = (Me.mNombreEntidad + "_SelectAll")
            dtDatos = Me.ServidorDatos.TraerDataTable(param)
            For Each dr As DataRow In dtDatos.Rows
            Dim mtEtapas As New tEtapas
				mtEtapas.IdEtapas = CType(dr.Item("IdEtapas"),Integer)
				mtEtapas.Traer_objeto()
            	listatEtapas.Add( mtEtapas)
    		Next dr
Return listatEtapas
End Function

Public Function TraerFiltradoListOf(ByVal Filtro As [String], ByVal Args As Object) As List(Of tEtapas)
            Dim dtDatos As DataTable
            Dim param As [String]
            Dim listatEtapas As New List(Of tEtapas)
            param = (Me.mNombreEntidad + "_Tx")
            param = (param + Filtro.ToString)
            dtDatos = Me.ServidorDatos.TraerDataTable(param, Args)
            For Each dr As DataRow In dtDatos.Rows
            Dim mtEtapas As New tEtapas
				mtEtapas.IdEtapas = CType(dr.Item("IdEtapas"),Integer)
				mtEtapas.Traer_objeto()
            	listatEtapas.Add( mtEtapas)
    		Next dr
Return listatEtapas
End Function

Public Function TraerFiltradoLikeListOf(ByVal Filtro As [String], ByVal Args As Object) As List(Of tEtapas)
            Dim dtDatos As DataTable
            Dim param As [String]
            Dim listatEtapas As New List(Of tEtapas)
            param = (Me.mNombreEntidad + "_TxLike")
            param = (param + Filtro.ToString)
            dtDatos = Me.ServidorDatos.TraerDataTable(param, Args)
            For Each dr As DataRow In dtDatos.Rows
            Dim mtEtapas As New tEtapas
				mtEtapas.IdEtapas = CType(dr.Item("IdEtapas"),Integer)
				mtEtapas.Traer_objeto()
            	listatEtapas.Add( mtEtapas)
    		Next dr
Return listatEtapas
End Function
# End Region

End Class
End Namespace
